﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Web.UI;
using System.Web.UI.WebControls;
using weikebuluo.DAL;
using weikebuluo.Model;
using weikebuluo.Common;

namespace weikeweixin.web.admin.order
{
    public partial class orderlist : weikeweixin.web.admin.cs.adminbase
    {
        a_order_dal orderdal = new a_order_dal();
        a_orderfood_dal orderfooddal = new a_orderfood_dal();
        JsonOperate JsonOperate = new JsonOperate();
        protected string Url = "";

        protected void Page_Load(object sender, EventArgs e)
        {
            Url = Request.Url.Authority + "/web/wechat/orderfood/choosefood.aspx?sid="+user_id;
            switch (Request.QueryString["action"])
            {
                case "list":
                    list();
                    break;
                case "view":
                    view();
                    break;
            }

        }

        /// <summary>
        ///查询
        /// </summary>
        public void list()
        {
            string where = "store_id=" + user_id;
            int Page = int.Parse(Request.Form["page"]);
            int RecordCount = orderdal.GetRecordCount(where);
            DataTable dtorder = orderdal.GetListByPage(where, "", ((Page - 1) * 10) + 1, (Page - 1) * 10 + 10).Tables[0];
            Response.Write(JsonOperate.GetDataGridJson(dtorder, RecordCount));
            Response.End();
        }

        private void view() {
            DataTable dtorderfood = orderfooddal.GetList1("store_id="+user_id).Tables[0];
            Response.Write(JsonOperate.TableToBasicJson(dtorderfood));
            Response.End();
        }

    }
}
